
#include <mysql_driver.h>
#include <mysql_connection.h>


using namespace std;
using namespace sql;


#define HOST "localhost"
#define USER "root"
#define PASSWORD "xiaobai"
#define DATABASE "toolsys"
#define PORT 3306

int main() {

    // todo 存在问题, 一直提示 check_lib 失败
    try {
        mysql::MySQL_Driver *driver;
        Connection *conn;

        driver = mysql::get_mysql_driver_instance();
        conn = driver->connect("tcp://192.168.1.3:3306", USER, PASSWORD);

        if (conn != nullptr) {
            printf("成功!");
            delete conn;
        }

    } catch (exception &e) {
        cout << "catch:" << e.what() << endl;
        printf("error");
    }
    return 0;
}